﻿using System;
using System.Collections.Generic;
using System.Text;
using Pixysoft.Weblications.Sango.Entities;
using Pixysoft.Framework.Verifications;

namespace Pixysoft.Weblications.Sango.Environment
{
    class PtyPartyResourceSettingHelper
    {
        private static List<Pty_Partyresourcesetting> orms = new List<Pty_Partyresourcesetting>();

        public static void initialize()
        {
            orms = SettingHelper.GetNoebe().EntityNoebeCommand.Select<Entities.Pty_Partyresourcesetting>();
            LoggerHelper.Info("initialize Pty_Partyresourcesetting.count:{0}", orms.Count);
        }

        public static List<Pty_Partyresourcesetting> searchAll()
        {
            return orms;
        }

        public static Pty_Partyresourcesetting search(int serialcode)
        {
            foreach (Pty_Partyresourcesetting orm in orms)
            {
                if (serialcode == orm.Resourceserialcode)
                {
                    return orm;
                }
            }

            throw Exceptions.VerificationFailedException(serialcode);
        }
    }
}
